package com.umbacos.udm.client.view;

import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.umbacos.udm.client.arch.HourGlass;
import com.umbacos.udm.client.model.View;

public class MainView extends View {

	private Button btServer = new Button();
	private CheckBox ckServerFiles = new CheckBox("Load File info");
	private CheckBox ckServerTrack = new CheckBox("Load Tracker info");
	public final HourGlass hourglass;
	private TextBox tbServer = new TextBox();

	private DockLayoutPanel dlp = new DockLayoutPanel(Unit.PX);
	private VerticalPanel vpNavigation = new VerticalPanel();
	private ScrollPanel spContent = new ScrollPanel();
	private VerticalPanel vpContent = new VerticalPanel();

	public MainView() {

		RootLayoutPanel rlp=RootLayoutPanel.get();

		hourglass = new HourGlass(rlp);
		hourglass.wait(true);

		Image logo = new Image();
		logo.setUrl("images/logo.png");

		// vpNavigation
		tbServer.addStyleName("tbServer");
		tbServer.setText("192.168.1.254");
		btServer.setText("Check Server");

		vpNavigation.add(tbServer);
		vpNavigation.add(ckServerFiles);
		vpNavigation.add(ckServerTrack);
		vpNavigation.add(btServer);

		spContent.add(vpContent);
		
		dlp.addNorth(logo, 100);
		dlp.addWest(vpNavigation, 150);
		dlp.add(spContent);

		rlp.add(dlp);
		hourglass.wait(false);
	}
	
	public void add(Widget w){
		if (vpContent!=null)
			vpContent.add(w);
		else
			super.add(w);
	}
}
